898051ecff5c10540ea9a0933a0df3f752d87826,server/src/com/cloud/network/element/VirtualRouterElement.java,VirtualRouterElement,restart,#Network#ReservationContext#,137

Before Change


        /* Get the host_id in order to find the cluster */
        long host_id = 0;
        for (DomainRouterVO router : routers) {
            host_id = router.getHostId();
            /* FIXME it's not completely safe to ignore these failure, but we would try to push on now */
            if (_routerMgr.stopRouter(router.getId(), false) == null) {
                s_logger.warn("Failed to stop virtual router element " + router + " as a part of network " + network + " restart");

After Change


        }

        /* Get the host_id in order to find the cluster */
        Long host_id = new Long(0);
        for (DomainRouterVO router : routers) {
            if (host_id == null || host_id == 0) {
                host_id = (router.getHostId() != null ? router.getHostId() : router.getLastHostId());
            }
            /* FIXME it's not completely safe to ignore these failure, but we would try to push on now */
            if (router.getState() != State.Stopped || _routerMgr.stopRouter(router.getId(), false) == null) {
                s_logger.warn("Failed to stop virtual router element " + router + " as a part of network " + network + " restart");
            }
            if (!_routerMgr.destroyRouter(router.getId())) {
                s_logger.warn("Failed to destroy virtual router element " + router + " as a part of network " + network + " restart");
            }
        }
        if (host_id == null || host_id == 0) {
            throw new ResourceUnavailableException("Fail to locate virtual router element in network " + network.getId(), this.getClass(), 0);
        }
        
        /* The cluster here is only used to determine hypervisor type, not the real deployment */